From 23d4beead1fc13ef200ec71d5e6bd5682d6d0368 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 22 May 2018 12:20:15 +0100 Subject: [PATCH] lib/repo-pull: Factor out enqueue function for FetchStaticDeltaData This introduces no functional changes, but will make upcoming support for retrying downloads easier to add. Signed-off-by: Philip Withnall Closes: #1599 Approved by: jlebon --- src/libostree/ostree-repo-pull.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c index b9cafa9d..f05f8835 100644 --- a/src/libostree/ostree-repo-pull.c +++ b/src/libostree/ostree-repo-pull.c @@ -226,6 +226,8 @@ static void queue_scan_one_metadata_object_c (OtPullData *pull_da static void enqueue_one_object_request_s (OtPullData *pull_data, FetchObjectData *fetch_data); +static void enqueue_one_static_delta_part_request_s (OtPullData *pull_data, + FetchStaticDeltaData *fetch_data); static gboolean scan_one_metadata_object (OtPullData *pull_data, const char *checksum, @@ -2131,6 +2133,24 @@ process_one_static_delta_fallback (OtPullData *pull_data, return TRUE; } +static void +enqueue_one_static_delta_part_request_s (OtPullData *pull_data, + FetchStaticDeltaData *fetch_data) +{ + if (fetcher_queue_is_full (pull_data)) + { + g_debug ("queuing fetch of static delta %s-%s part %u", + fetch_data->from_revision ?: "empty", + fetch_data->to_revision, fetch_data->i); + + g_hash_table_add (pull_data->pending_fetch_deltaparts, fetch_data); + } + else + { + start_fetch_deltapart (pull_data, fetch_data); + } +} + static void start_fetch_deltapart (OtPullData *pull_data, FetchStaticDeltaData *fetch) @@ -2313,12 +2333,7 @@ process_one_static_delta (OtPullData *pull_data, } else { - if (!fetcher_queue_is_full (pull_data)) - start_fetch_deltapart (pull_data, fetch_data); - else - { - g_hash_table_add (pull_data->pending_fetch_deltaparts, fetch_data); - } + enqueue_one_static_delta_part_request_s (pull_data, g_steal_pointer (&fetch_data)); } } -- 2.30.2